package com.kyzh.core.adapters

import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gushenge.core.beans.Video
import com.kyzh.core.R
import com.kyzh.core.databinding.ItemVideoAttentionBinding

class VideoLikeAdapter(layout:Int,beans:ArrayList<Video>):BaseQuickAdapter<Video, BaseViewHolder>(layout,beans) ,LoadMoreModule{

    init {
        addChildClickViewIds(
                R.id.ivQuxiao,
                R.id.tvDetail
        )
    }
    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        DataBindingUtil.bind<ItemVideoAttentionBinding>(viewHolder.itemView)
    }
    override fun convert(holder: BaseViewHolder, item: Video) {
        holder.getBinding<ItemVideoAttentionBinding>()?.data = item
        val bq = holder.getView<RecyclerView>(R.id.bq)
        bq.layoutManager = LinearLayoutManager(context, RecyclerView.HORIZONTAL, false)
        bq.adapter = BqSoildAdapter(R.layout.bq_item, item.biaoqian)
    }
}